package org.gap.wizards;

import java.io.IOException;

import org.gap.wizards.pc.PlayerCharacter;
import org.gap.wizards.state.TransitionState;
import org.gap.wizards.utils.FlatFilePersistence;
import org.gap.wizards.utils.PersistenceUtils;
import org.gap.wizards.views.ViewPlatform;
import org.gap.wizards.world.MapContainer;
import org.gap.wizards.world.TimerState;

public class ShutdownGame implements TransitionState {

	private final MapContainer container;
	private final PlayerCharacter player;
	private final TimerState timer;

	public ShutdownGame(MapContainer container, PlayerCharacter player,	TimerState timer) {
		this.container = container;
		this.player = player;
		this.timer = timer;
	}

	@Override
	public void acceptKey(char keyPress) {

	}

	@Override
	public void draw(ViewPlatform console) {

	}

	@Override
	public void enter() {
		try {
			PersistenceUtils.createSave();
			FlatFilePersistence persister = new FlatFilePersistence(false, "World", "wizard", "save", "map");
			container.persist(persister);
			player.persist();
			timer.persist();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	@Override
	public void exit() {
	}
}
